import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/generated/locales.g.dart';

class WarnDialog extends Dialog {

  final Function callback;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        child: Material(
            type: MaterialType.transparency,
            child: Center(
                child: GestureDetector(
                    onTap: () {
                      print('～');
                    },
                    child: Container(
                        width: 916.w,
                        height: 580.h,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(10),
                          color: Colors.white,
                        ),
                        child: Column(
                            children: [
                              Container(
                                  alignment: Alignment.topCenter,
                                  margin: EdgeInsets.only(top: 64.h),
                                  child: Text(LocaleKeys.restoration_device_warn.ts, style: TextStyle(fontSize: 54.sp, color: ColorConst.btnFontColor),)
                              ),
                              Container(
                                  margin: EdgeInsets.fromLTRB(70.w, 89.h, 70.w, 0),
                                  alignment: Alignment.center,
                                  child: Text(LocaleKeys.restoration_device_warn_content.ts, style: TextStyle(fontSize: 54.sp, color: ColorConst.btnFontColor))
                              ),
                              Container(
                                  height: 90.h,
                                  margin: EdgeInsets.only(top: 96.h),
                                  child: Row(
                                      children: [
                                        Expanded(
                                            child: GestureDetector(
                                                behavior: HitTestBehavior.opaque,
                                                child: Container(
                                                    height: double.infinity,
                                                    alignment: Alignment.center,
                                                    child: Text(
                                                        LocaleKeys.person_choice_cancel.ts,
                                                        textAlign: TextAlign.center,
                                                        style: TextStyle(
                                                          color: ColorConst.btnFontColor,
                                                          fontSize: 54.sp,
                                                        )
                                                    )
                                                ),
                                                onTap: () {
                                                  Navigator.pop(context);
                                                }
                                            )
                                        ),
                                        Container(
                                            width: 1.w,
                                            height: 70.h,
                                            decoration: const BoxDecoration(
                                                border: Border(right: BorderSide(width: 1,color: Color(0xFFE0E0E0)))
                                            )
                                        ),
                                        Expanded(
                                            child: GestureDetector(
                                                behavior: HitTestBehavior.opaque,
                                                child: Container(
                                                    height: double.infinity,
                                                    alignment: Alignment.center,
                                                    child: Text(
                                                        LocaleKeys.person_choice_submit.ts,
                                                        textAlign: TextAlign.center,
                                                        style: TextStyle(
                                                          color: ColorConst.btnFontColor,
                                                          fontSize: 54.sp,
                                                        )
                                                    )
                                                ),
                                                onTap: () {
                                                  callback("");
                                                  Navigator.pop(context);
                                                }
                                            )
                                        )
                                      ]
                                  )
                              )
                            ]
                        )
                    )
                )
            )
        ),
        onTap: () {
          Navigator.pop(context);
        }
    );
  }

  WarnDialog({required this.callback}); // 内容
}